<template>
	<view :class="vi_pageSize">
		<vi-notify :top="topfix" ref="vi_notify"></vi-notify>
		<module-loading ref="vi_loading" :loading="vi_loading" :loadingMask="vi_loadingMask"></module-loading>
		<vi-headbar goback>
			<view slot="right">
				响应式
				<text class="response">开启</text>
				<text class="noresponse color-warning">关闭</text>
			</view>
			{{vi_pageTitle}}
		</vi-headbar>
		<view class="docTable">
			<view class="th">
				<view>属性名</view>
				<view>类型</view>
				<view>默认值</view>
				<view>描述</view>
			</view>
			<view class="tr">
				<view>type</view>
				<view>String</view>
				<view>primary</view>
				<view>树主题色</view>
			</view>
			<view class="tr">
				<view>color</view>
				<view>String</view>
				<view>无</view>
				<view>树自定义主题色</view>
			</view>
			<view class="tr">
				<view>radius</view>
				<view>String, Number</view>
				<view>circle</view>
				<view>按钮、输入框圆角</view>
			</view>
			<view class="tr">
				<view>size</view>
				<view>String</view>
				<view>md</view>
				<view>预定义尺寸，用于搜索条、提交按钮</view>
			</view>
			<view class="tr">
				<view>treeStyle</view>
				<view>String</view>
				<view>tree</view>
				<view>显示模式，tree普通树模式，page翻页树模式</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>dataList</view>
					<view>Array, Object</view>
					<view>无</view>
					<view>树数据集</view>
				</view>
				<view class="appendix">
					格式：{id:"id", name:"标题", children:[]}
					<view>id、name、children键名可自定义，必须有标题内容</view>
				</view>
			</view>
			<view class="tr">
				<view>value</view>
				<view>Array</view>
				<view>无</view>
				<view>初始选中id列表，idKey已设置的情况下有效，传入id数组设置初始选中。否则需在节点设置_checked=true指定节点选中</view>
			</view>
			<view class="tr">
				<view>searchSet</view>
				<view>Object</view>
				<view>无</view>
				<view>搜索条设置参数，同searchbar组件</view>
			</view>
			<view class="tr">
				<view>searchLeaf</view>
				<view>Boolean</view>
				<view>true</view>
				<view>只搜索叶子节点</view>
			</view>
			<view class="tr">
				<view>keyword</view>
				<view>String</view>
				<view>无</view>
				<view>初始关键词，有则在初始化时执行搜索</view>
			</view>
			<view class="tr">
				<view>checkboxPlain</view>
				<view>Boolean</view>
				<view>false</view>
				<view>复选框镂空</view>
			</view>
			<view class="tr">
				<view>nodeIndent</view>
				<view>Number</view>
				<view>1.5</view>
				<view>子节点缩进，固定单位em，tree模式有效</view>
			</view>
			<view class="tr">
				<view>iconSpace</view>
				<view>Number</view>
				<view>0.25</view>
				<view>图标与标题间隙，固定单位em，tree模式有效</view>
			</view>
			<view class="tr">
				<view>useIconStatus</view>
				<view>Boolean</view>
				<view>true</view>
				<view>使用展开状态图标，tree模式有效</view>
			</view>
			<view class="tr">
				<view>useIconNode</view>
				<view>Boolean</view>
				<view>true</view>
				<view>使用节点图标</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>mode</view>
					<view>String</view>
					<view>checkbox</view>
					<view>树模式</view>
				</view>
				<view class="appendix">
					<view>show：显示模式，点击叶子触发提交事件</view>
					<view>radio：单选模式，点击叶子触发值改变事件</view>
					<view>checkbox：多选模式</view>
					<view>edit：编辑模式（未开发）</view>
				</view>
			</view>
			<view class="tr">
				<view>selectNode</view>
				<view>Boolean</view>
				<view>false</view>
				<view>枝节点可选，show、radio模式有效</view>
			</view>
			<view class="tr">
				<view>autoNodeType</view>
				<view>Boolean</view>
				<view>true</view>
				<view>自动计算节点类型，开启则将第一层级节点设为根，无children的节点设为叶子。关闭则须在节点手动设置_isRoot=true指定根，_isLeaf=true指定叶子</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>resFormat</view>
					<view>String</view>
					<view>无</view>
					<view>返回结果格式，可选：</view>
				</view>
				<view class="appendix">
					<view>node节点</view>
					<view>value值(未定义valueKey则报错)</view>
					<view>count计数</view>
					<view>path带路径</view>
					<view>为空判断valueKey，有则返回值，无则返回节点</view>
					<view>其他当做key处理，提取属性值</view>
				</view>
			</view>
			<view class="tr">
				<view>pageNavHeight</view>
				<view>Number</view>
				<view>2.5</view>
				<view>page模式，面包屑导航高度，固定单位em</view>
			</view>
			<view class="tr">
				<view>pageNavBgColor</view>
				<view>String</view>
				<view>#eee</view>
				<view>page模式，面包屑导航背景色</view>
			</view>
			<view class="tr">
				<view>useToolbar</view>
				<view>Boolean</view>
				<view>true</view>
				<view>显示工具栏，提交按钮，选择计数。radio、checkbox模式有效</view>
			</view>
			<view class="tr">
				<view>submitWidth</view>
				<view>String, Number</view>
				<view>0</view>
				<view>提交按钮宽度，默认占满</view>
			</view>
			<view class="tr">
				<view>submitPlain</view>
				<view>Boolean</view>
				<view>false</view>
				<view>提交按钮镂空</view>
			</view>
			<view class="tr">
				<view>toolbarHeight</view>
				<view>Number</view>
				<view>2.5</view>
				<view>工具栏、提交按钮高度，固定单位em</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>keys</view>
					<view>Object</view>
					<view></view>
					<view>数据键名设置</view>
				</view>
				<view class="appendix">
					<view>name：name 标题名称</view>
					<view>value：value 真实值</view>
					<view>children：children 子集列表</view>
				</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>icon</view>
					<view>Object</view>
					<view></view>
					<view>iconfont图标数据覆盖</view>
				</view>
				<view class="appendix">
					格式：{key:"图标名"}
					<view>root：icon-tree-root 根图标</view>
					<view>rootOpen：无 根打开图标</view>
					<view>node：icon-tree-node 枝节点图标</view>
					<view>nodeOpen：无 枝节点打开图标</view>
					<view>leaf：icon-tree-leaf 叶子图标</view>
					<view>open：icon-triangle-down 指示展开图标</view>
					<view>close：icon-triangle-right 指示收起图标</view>
					<view>checked：icon-checked 复选框选中</view>
					<view>parts：icon-tree-parts 复选框部分选中</view>
					<view>navNext：icon-arr-right page模式导航箭头</view>
					<view>delete：icon-delete 删除</view>
				</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>text</view>
					<view>Object</view>
					<view></view>
					<view>内部文字数据覆盖</view>
				</view>
				<view class="appendix">
					格式：{key:"文字"}
					<view>confirm：确定　提交按钮</view>
					<view>tipNoData：暂无数据　接口无数据提示</view>
					<view>tipNoResult：无搜索结果　搜索无数据提示</view>
					<view>tipTreeEmptyError：请先选择选项　未选择提交提示</view>
				</view>
			</view>
			<view class="tr">
				<view>disabled</view>
				<view>Boolean</view>
				<view>false</view>
				<view>禁用</view>
			</view>
			<view class="tr">
				<view>readOnly</view>
				<view>Boolean</view>
				<view>false</view>
				<view>只读</view>
			</view>
			<view class="tr">
				<view>@change</view>
				<view>事件</view>
				<view>	</view>
				<view>选中值改变事件，单选时提交选中节点，多选时提交选择列表</view>
			</view>
			<view class="tr">
				<view>@submit</view>
				<view>事件</view>
				<view>	</view>
				<view>选择提交事件，单选时提交选中节点，多选时提交选择列表</view>
			</view>
			<view class="tr">
				<view>selectAll</view>
				<view>function</view>
				<view>	</view>
				<view>使用refs调用，选择全部节点</view>
			</view>
			<view class="tr">
				<view>clearAll</view>
				<view>function</view>
				<view>	</view>
				<view>使用refs调用，清空选中</view>
			</view>
			<view class="tr extra">
				<view class="body">
					<view>getData</view>
					<view>function</view>
					<view>	</view>
					<view>使用refs调用，根据参数获取树数据</view>
				</view>
				<view class="appendix">
					格式：getData({type:"checked", format:"node", key:""})
					<view>
						type：抽取结果集合，可选：
						<view class="ml-e2">checked：选中列表</view>
						<view class="ml-e2">root：所有根</view>
						<view class="ml-e2">node：所有树枝</view>
						<view class="ml-e2">leaf：所有叶子</view>
					</view>
					<view class="mt-e1">
						format：结果集合的返回格式，可选：
						<view class="ml-e2">id：节点id(自动设置的id也返回)</view>
						<view class="ml-e2">key：指定键值(须设置第三个参数key)</view>
						<view class="ml-e2">count：计数</view>
						<view class="ml-e2">path：带路径的节点信息对象</view>
						<view class="ml-e2">默认返回节点本身</view>
					</view>
				</view>
			</view>
			<view class="tr">
				<view>initData</view>
				<view>function</view>
				<view>	</view>
				<view>使用refs调用，数据初始化，可用来重置操作，还原初始选中</view>
			</view>
		</view>
		
		
		<view class="p-sm">
			<vi-collapse title="搜索条参数 searchSet" headClass="bgColor-contrast" boxClass="b-default">
				<view class="docSubTable">
					<view class="th">
						<view>属性名</view>
						<view>类型</view>
						<view>描述</view>
					</view>
					<view class="tr">
						<view>open</view>
						<view>Boolean</view>
						<view>开启搜索条，默认值：false</view>
					</view>
					<view class="tr">
						<view>height</view>
						<view>Number</view>
						<view>搜索条高度，固定单位em，默认值：2</view>
					</view>
					<view class="tr">
						<view>bgColor</view>
						<view>String</view>
						<view>输入框背景色，默认值：#eee</view>
					</view>
					<view class="tr">
						<view>plain</view>
						<view>Boolean</view>
						<view>输入框镂空，默认值：false</view>
					</view>
					<view class="tr">
						<view>placeholder</view>
						<view>String</view>
						<view>输入框空值提示，默认值：请输入关键词</view>
					</view>
					<view class="tr extra">
						<view class="body">
							<view>buttonStyle</view>
							<view>String</view>
							<view>搜索按钮样式，默认值：iconRight</view>
						</view>
						<view class="appendix">
							<view>iconLeft内部左侧图标，iconRight内部右侧图标</view>
							<view>outsideLeft外部左侧按钮，outsideRight外部右侧按钮</view>
							<view>insideLeft内部左侧衔接按钮，insideRight内部右侧衔接按钮</view>
							<view>active动态搜索(注意性能问题)</view>
						</view>
					</view>
				</view>
			</vi-collapse>
		</view>
		
		
		<view class="p-sm">
			<view class="py-sm">
				树默认占满100%的宽高，需用一个具有宽高值的外框包裹
			</view>
			<view class="py-sm">
				基本使用：{{'&lt;vi-tree :dataList="数据集">&lt;/vi-tree>'}}
			</view>
			<view class="py-sm" style="height: 300px;">
				<vi-tree :dataList="tree" :searchSet="{open:true, buttonStyle:'insideRight'}"></vi-tree>
			</view>
			<view class="py-sm" style="height: 300px;">
				<view class="py-sm">分页树</view>
				<vi-tree :dataList="tree" treeStyle="page" :searchSet="{open:true, buttonStyle:'insideRight'}"></vi-tree>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tree:{
					aa:1,
					name:"根节点",
					children:[
						{aa:2,name:"二级子节点1超长"},
						{aa:3,name:"二级子节点2",checked:true},
						{aa:4,name:"二级子节点3",children:[
							{aa:6,name:"三级子节点1超长",children:[
								{aa:7,name:"四级子节点1超长",children:[{aa:8,name:"五级子节点1超长"}]},
							]},
						]},
						{aa:5,name:"二级子节点4"},
						{aa:5,name:"二级子节点5"},
						{aa:5,name:"二级子节点6"},
						{aa:5,name:"二级子节点7"},
						{aa:5,name:"二级子节点8"},
					]
				},
			}
		},
		methods: {
			
		}
	}
</script>

<style lang="scss" scoped>
.response{
	display: if($useResponse, inline, none);
}
.noresponse{
	display: if($useResponse, none, inline);
}
</style>
